package com.toubutu.audio.admin.dto;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.toubutu.audio.common.QueryBaseDto;
import com.toubutu.audio.entity.VideoTag;
import com.toubutu.constants.BaseConstants;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.apache.commons.lang3.StringUtils;

/**
 * @author 戒躁
 * @version 1.0
 * @date 2024年01月14日 17:53
 */
@EqualsAndHashCode(callSuper = true)
@Data
public class AdminVideoTagQueryDto extends QueryBaseDto<VideoTag> {
    private Integer tagId;
    private String tagName;
    @Override
    public LambdaQueryWrapper<VideoTag> getWrapper() {
        LambdaQueryWrapper<VideoTag> queryWrapper = new LambdaQueryWrapper<>();
        if (tagId!=null){
            queryWrapper.eq(VideoTag::getTagId,tagId);
        }
        if (StringUtils.isNotBlank(tagName)){
            queryWrapper.like(VideoTag::getTagName,tagName);
        }
        queryWrapper.eq(VideoTag::getIsDelete, BaseConstants.UN_DELETED);
        return queryWrapper;
    }
}
